// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
// import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/dashboard/workplace',
    children: [
      {
        path: '/dashboard',
        name: 'dashboard',
        component: RouteView,
        meta: { title: 'menu.dashboard', keepAlive: true, icon: 'dashboard' },
        children: [
          {
            path: 'workplace',
            name: 'Workplace',
            component: () => import('@/views/dashboard/Workplace'),
            meta: { title: 'menu.dashboard.workplace', keepAlive: true }
          }
        ]
      },
      {
        path: '/systemManage',
        name: 'systemManage',
        component: RouteView,
        meta: { title: 'menu.systemManage', icon: 'setting' },
        children: [
          {
            path: 'userManage',
            name: 'userManage',
            component: () => import('@/views/systemManage/userManage'),
            meta: { title: 'menu.systemManage.userManage' }
          },
          {
            path: 'clientManage',
            name: 'clientManage',
            component: () => import('@/views/systemManage/clientManage'),
            meta: { title: 'menu.systemManage.clientManage' }
          },
          {
            path: 'roleManage',
            name: 'roleManage',
            component: () => import('@/views/systemManage/roleManage'),
            meta: { title: 'menu.systemManage.roleManage' }
          }
        ]
      },
      {
        path: '/basicMaterial',
        name: 'basicMaterial',
        component: RouteView,
        meta: { title: 'menu.basicMaterial', icon: 'wallet' },
        children: [
          {
            path: 'supplierManage',
            name: 'supplierManage',
            component: () => import('@/views/basicMaterial/supplierManage'),
            meta: { title: 'menu.basicMaterial.supplierManage' }
          },
          {
            path: 'stuffManage',
            name: 'stuffManage',
            component: () => import('@/views/basicMaterial/stuffManage'),
            meta: { title: 'menu.basicMaterial.stuffManage' }
          },
          {
            path: 'repoManage',
            name: 'repoManage',
            component: () => import('@/views/basicMaterial/repoManage'),
            meta: { title: 'menu.basicMaterial.repoManage' }
          }
        ]
      },
      {
        path: '/purchase',
        name: 'purchase',
        component: RouteView,
        meta: { title: 'menu.purchase', icon: 'coffee' },
        children: [
          {
            path: 'purchaseOrder',
            name: 'purchaseOrder',
            component: () => import('@/views/purchase/purchaseOrder'),
            meta: { title: 'menu.purchase.purchaseOrder' }
          },
          {
            path: 'purchaseAdd/:code?',
            name: 'purchaseAdd',
            component: () => import('@/views/purchase/purchaseAdd'),
            meta: { title: 'menu.purchase.purchaseAdd' }
          }
        ]
      },
      {
        path: '/user',
        name: 'user',
        component: RouteView,
        hidden: true,
        meta: { title: 'menu.user' },
        children: [
          {
            path: 'settings',
            name: 'settings',
            component: () => import('@/views/user/settings'),
            meta: { title: 'menu.user.settings' },
            redirect: '/user/settings/basic',
            children: [
              {
                path: 'basic',
                name: 'basicSetting',
                component: () => import('@/views/user/basicSetting'),
                meta: { title: 'menu.user.settings.basicSetting' }
              },
              {
                path: 'security',
                name: 'securitySetting',
                component: () => import('@/views/user/securitySetting'),
                meta: { title: 'menu.user.settings.securitySetting' }
              },
              {
                path: 'notification',
                name: 'notification',
                component: () => import('@/views/user/notification'),
                meta: { title: 'menu.user.settings.notification' }
              }
            ]
          }
        ]
      },
      {
        path: '/audit',
        name: 'audit',
        component: RouteView,
        meta: { title: 'menu.audit', icon: 'audit' },
        children: [
          {
            path: 'auditPurchase',
            name: 'auditPurchase',
            component: () => import('@/views/audit/auditPurchase'),
            meta: { title: 'menu.audit.auditPurchase' }
          },
          {
            path: 'auditPurchaseOrder/:cd?',
            name: 'auditPurchaseOrder',
            hidden: true,
            component: () => import('@/views/audit/auditPurchaseOrder'),
            meta: { title: 'menu.audit.auditPurchaseOrder' }
          },
          {
            path: 'auditSale',
            name: 'auditSale',
            component: () => import('@/views/audit/auditSale'),
            meta: { title: 'menu.audit.auditSale' }
          },
          {
            path: 'auditSaleOrder/:asl?',
            name: 'auditSaleOrder',
            hidden: true,
            component: () => import('@/views/audit/auditSaleOrder'),
            meta: { title: 'menu.audit.auditSaleOrder' }
          },
          {
            path: 'auditRejectSale',
            name: 'auditRejectSale',
            component: () => import('@/views/audit/auditRejectSale'),
            meta: { title: 'menu.audit.auditRejectSale' }
          },
          {
            path: 'auditRejectSaleOrder/:reject?',
            name: 'auditRejectSaleOrder',
            hidden: true,
            component: () => import('@/views/audit/auditRejectSaleOrder'),
            meta: { title: 'menu.audit.auditRejectSaleOrder' }
          }
        ]
      },
      {
        path: '/sale',
        name: 'sale',
        component: RouteView,
        meta: { title: 'menu.sale', icon: 'shop' },
        children: [
          {
            path: 'saleManage',
            name: 'saleManage',
            component: () => import('@/views/sale/saleManage'),
            meta: { title: 'menu.sale.saleManage' }
          },
          {
            path: 'saleAdd/:sale?',
            name: 'saleAdd',
            component: () => import('@/views/sale/saleAdd'),
            meta: { title: 'menu.sale.saleAdd' }
          },
          {
            path: 'saleRejectManage',
            name: 'saleRejectManage',
            component: () => import('@/views/sale/saleRejectManage'),
            meta: { title: 'menu.sale.saleRejectManage' }
          },
          {
            path: 'saleReject',
            name: 'saleReject',
            component: () => import('@/views/sale/saleReject'),
            meta: { title: 'menu.sale.saleReject' }
          },
          {
            path: 'rejectAuditDetail/:rejectCode?',
            name: 'rejectAuditDetail',
            hidden: true,
            component: () => import('@/views/sale/rejectAuditDetail')
          }
        ]
      },
      {
        path: '/repo',
        name: 'repo',
        component: RouteView,
        meta: { title: 'menu.repo', icon: 'database' },
        children: [
          {
            path: 'purchaseInRepo',
            name: 'purchaseInRepo',
            component: () => import('@/views/repo/purchaseInRepo'),
            meta: { title: 'menu.repo.purchaseInRepo' }
          },
          {
            path: 'purchaseInRepoManage',
            name: 'purchaseInRepoManage',
            component: () => import('@/views/repo/purchaseInRepoManage'),
            meta: { title: 'menu.repo.purchaseInRepoManage' }
          },
          {
            path: 'purchaseOutRepo',
            name: 'purchaseOutRepo',
            component: () => import('@/views/repo/purchaseOutRepo'),
            meta: { title: 'menu.repo.purchaseOutRepo' }
          },
          {
            path: 'purchaseOutRepoManage',
            name: 'purchaseOutRepoManage',
            component: () => import('@/views/repo/purchaseOutRepoManage'),
            meta: { title: 'menu.repo.purchaseOutRepoManage' }
          },
          {
            path: 'saleInRepo',
            name: 'saleInRepo',
            component: () => import('@/views/repo/saleInRepo'),
            meta: { title: 'menu.repo.saleInRepo' }
          },
          {
            path: 'saleInRepoManage',
            name: 'saleInRepoManage',
            component: () => import('@/views/repo/saleInRepoManage'),
            meta: { title: 'menu.repo.saleInRepoManage' }
          },
          {
            path: 'saleOutRepo',
            name: 'saleOutRepo',
            component: () => import('@/views/repo/saleOutRepo'),
            meta: { title: 'menu.repo.saleOutRepo' }
          },
          {
            path: 'saleOutRepoManage',
            name: 'saleOutRepoManage',
            component: () => import('@/views/repo/saleOutRepoManage'),
            meta: { title: 'menu.repo.saleOutRepoManage' }
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      }
    ]
  },
  {
    path: '/404',
    name: '*',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
